﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.BreedingWeighCommand;
using IntelligentAgriculture.WebAPI.Application.Command.DepartMentCommand;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.DepartMentCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.BreedingWeighCommandHandler
{
    public class BreedingDeleteCommandHandler : IRequestHandler<BreedingWeighDeleteCommand, Results<int>>
    {


        private readonly IBreedingWeighService breeingService;
        private readonly ILogger<BreedingDeleteCommandHandler> logger;
        public BreedingDeleteCommandHandler(IBreedingWeighService breeingService, ILogger<BreedingDeleteCommandHandler> logger)
        {
            this.breeingService = breeingService;
            this.logger = logger;
        }


        /// <summary>
        /// 羊只删除信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<int>> Handle(BreedingWeighDeleteCommand request, CancellationToken cancellationToken)
        {

            var list = await breeingService.Delete(request.BreedingID);
            return Results<int>.DataResult(list);

        }





    }




}
